package org.faradel.pharmapp.entities;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.springframework.stereotype.Component;

/**
 * The persistent class for the Medication database table.
 * 
 */
@Entity
@Table(name = "Medication")
@Component("medication")
public class Medication implements Serializable
{
    private static final long serialVersionUID = 1L;

    @Id
    @Column(name = "medication_Id")
    @GeneratedValue(strategy = GenerationType.AUTO)
    private int medicationId;

    @Column(name = "dosage_form")
    private String dosageForm;

    @Column(name = "generic_name")
    private String genericName;

    @Column(name = "user_last_modified")
    private int userLastModified;

    @Column(name = "medication_class")
    private String medicationClass;

    @Column(name = "medication_desc")
    private String medicationDesc;

    @Column(name = "medication_name")
    private String medicationName;

    @Column(name = "medication_strength")
    private String medicationStrength;

    @Column(name = "upc_code")
    private String upcCode;

    @Column(name = "last_modified")
    private Date lastModified;

    // bi-directional many-to-one association to MedicationOrder
    @OneToMany(mappedBy = "medication")
    private List<MedicationOrder> medicationOrders;

    public Medication()
    {
    }

    public int getMedicationId()
    {
        return this.medicationId;
    }

    public void setMedicationId(int medication_Id)
    {
        this.medicationId = medication_Id;
    }

    public String getDosageForm()
    {
        return this.dosageForm;
    }

    public void setDosageForm(String dosage_form)
    {
        this.dosageForm = dosage_form;
    }

    public String getGenericName()
    {
        return this.genericName;
    }

    public void setGenericName(String genericName)
    {
        this.genericName = genericName;
    }

    public Date getLastModified()
    {
        return this.lastModified;
    }

    public void setLastModified(Date lastModified)
    {
        this.lastModified = lastModified;
    }

    public String getMedicationClass()
    {
        return this.medicationClass;
    }

    public void setMedicationClass(String medication_class)
    {
        this.medicationClass = medication_class;
    }

    public String getMedicationDesc()
    {
        return this.medicationDesc;
    }

    public void setMedicationDesc(String medication_desc)
    {
        this.medicationDesc = medication_desc;
    }

    public String getMedicationName()
    {
        return this.medicationName;
    }

    public void setMedicationName(String medication_name)
    {
        this.medicationName = medication_name;
    }

    public String getMedicationStrength()
    {
        return this.medicationStrength;
    }

    public void setMedicationStrength(String medication_strength)
    {
        this.medicationStrength = medication_strength;
    }

    public String getUpcCode()
    {
        return this.upcCode;
    }

    public void setUpcCode(String upcCode)
    {
        this.upcCode = upcCode;
    }

    public int getUserLastModified()
    {
        return this.userLastModified;
    }

    public void setUserLastModified(int userLastModified)
    {
        this.userLastModified = userLastModified;
    }

    public List<MedicationOrder> getMedicationOrders()
    {
        return this.medicationOrders;
    }

    public void setMedicationOrders(List<MedicationOrder> medicationOrders)
    {
        this.medicationOrders = medicationOrders;
    }

    public MedicationOrder addMedicationOrder(MedicationOrder medicationOrder)
    {
        getMedicationOrders().add(medicationOrder);
        medicationOrder.setMedication(this);

        return medicationOrder;
    }

    public MedicationOrder removeMedicationOrder(MedicationOrder medicationOrder)
    {
        getMedicationOrders().remove(medicationOrder);
        medicationOrder.setMedication(null);

        return medicationOrder;
    }

}